home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / KEY2.C < prev    next >
Text File  |  1993-06-14  |  2KB  |  70 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 06-12-93 (11:07)             Number: 265
  4. From: BILL LINDSAY                 Refer#: NONE
  5.   To: ALL                           Recvd: NO  
  6. Subj: Keyboard info         2/       Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. >>> Continued from previous message
  9. ___----------------------------8<------------------------------------
  10. int wait_for_key()
  11.  {
  12.    intregs.h.ah =  (is_enhanced) ? ('\x11') : ('\x01');
  13.  
  14.    int86 (0x16, &intregs, &intregs); /* check if key available */
  15.  
  16.    return ((intregs.x.flags & 0x0040));
  17.  
  18.  }  /* Returns 0 if keycode available */
  19.  
  20. int board_type ()
  21.  {
  22.    int i;
  23.  
  24.    intregs.h.ah = '\x05';
  25.    intregs.x.cx = 0xffff;
  26.  
  27.    int86 (0x16, &intregs, &intregs); /* Put xffff in buffer */
  28.  
  29.    for (i = 0; i < 16; i++)  {
  30.      if (!(wait_for_key()))
  31.        {                        /* Look for xffff in buffer */
  32.        intregs.h.ah = '\x10';
  33.        int86 (0x16, &intregs, &intregs);
  34.        if (intregs.x.ax == 0xffff)
  35.          break;
  36.        }
  37.      }
  38.    return (i == 16) ? (0) : (1);  /* was xffff returned? */
  39.  
  40.  } /* returns 1 for enhanced keyboard. */
  41.  
  42. void get_the_key (char *keys, unsigned char *togl)
  43.  {
  44.    while ((wait_for_key()))
  45.      {;}
  46.    intregs.h.al = '\x0';
  47.    intregs.h.ah = (is_enhanced) ?  ('\x12') : ('\x02');
  48.    int86 (0x16, &intregs, &intregs);   /* Get shift status */
  49.    *togl = intregs.h.al;
  50.    *(togl + 1) = intregs.h.ah;
  51.  
  52.    intregs.h.ah = (is_enhanced) ?  ('\x10') : ('\x00');
  53.    int86 (0x16, &intregs, &intregs);      /* Get Character */
  54.    *keys = intregs.h.ah;
  55.    *(keys + 1) = intregs.h.al;
  56.  }
  57.  
  58. ___------------------------ 8< --------------------------------------
  59.  
  60.                        -MESSAGE ENDS-
  61.  
  62.  
  63.  * SLMR 2.1a *
  64.  
  65. --- Maximus 2.01wb
  66.  * Origin: LIFELINE BBS - Edmonton, Ab, Canada! V32b (403)481-4977 (1:342/51)
  67. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  68. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
  69. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2430/1 2440/5 3603/20
  70.